
export default {
    namespaced: true,
    actions: {
        jiaOdd(context, value) {
            if (context.state.sum % 2)
                context.commit("JIA", value);
        },
        jiaWait(context, value) {
            setTimeout(() => {
                context.commit("JIA", value);
            }, 1000)
        },
    },
    mutations: {
        JIA(state, value) {
            // console.log('mutations中的jia被调用了',state,value);
            state.sum += value;
        },
        JIAN(state, value) {
            state.sum -= value;
        },
    },
    state: {
        sum: 0,
        name: 'yuxiaoyao',
        address: 'wanzhou',
    },
    getters: {
        largeSum(state) {
            return state.sum * 10
        }
    }
}
